<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition template="./../templates/default.xhtml">

            <ui:define name="top">
                Competence
            </ui:define>

            <ui:define name="content">
                <h:form>
                    <h:outputLabel for="competence" value="Competence" />
                    <br />
                    <h:selectOneMenu id="competence" value="#{jobApplicationView.personCompetence.competenceId}">
                        <f:selectItem itemLabel="Select one" noSelectionOption="true" />
                        <f:selectItems value="#{jobApplicationView.competenceList}" />
                    </h:selectOneMenu>
                    <br />
                    <h:outputLabel for="yearsOfExperience" value="Years of experience" />
                    <br />
                    <h:inputText id="yearsOfExperience" value="#{jobApplicationView.personCompetence.yearsOfExperience}" size="1"/>
                    <br />
                    <h:dataTable id="selectedPersonCompetence" value="#{jobApplicationView.personCompetenceList}" var="pc">
                        <h:column>
                            <f:facet name="header">Competence</f:facet>
                            #{pc.competenceId}
                        </h:column>
                        <h:column>
                            <f:facet name="header">Years</f:facet>
                            #{pc.yearsOfExperience}
                        </h:column>
                    </h:dataTable>
                    <f:ajax execute="@form" render="competence selectedPersonCompetence">
                    <h:commandButton value="Add" action="#{jobApplicationView.addCompetence()}" />
                    <h:commandButton value="Remove" action="#{jobApplicationView.delCompetence()}" />
                    </f:ajax>
                    <br />
                    <h:commandButton value="#{msgs.button_previous}" action="PersonalInfo?faces-redirect=true" />
                    <h:commandButton value="#{msgs.button_next}" action="#{jobApplicationView.processCompetence()}" />
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
